package com.guomei.controller;

import com.guomei.bean.SendVerifyCode;
import com.guomei.service.SmsService;
import com.guomei.utils.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 短信服务控制器
 * 提供短信相关HTTP接口
 */
@RestController
@RequestMapping("/api1/sms")
public class SmsController {
    @Resource
    SmsService smsService;
    /**
     * 发送验证码
     * @return
     */
    @PostMapping("/verify-code")
    public Result<Void> sendVerifyCode(@RequestBody SendVerifyCode sendVerifyCode) {
        return smsService.sendVerifyCode(sendVerifyCode);
    }
    /**
     * 发送固定翼验证码
     * @param phoneNumber 手机号码
     * @param content 验证码
     * @return
     */
    @PostMapping("/custom")
    public Result<Void> sendCustomSms(
            @RequestParam String phoneNumber,
            @RequestParam String content
    ) {
        return smsService.sendCustomSms(phoneNumber, content);
    }
}
